package com.lc202407;

public class Solution191 {
    public int hammingWeight(int n) {
        int num = 0;
        while (n / 2 != 0) {
            num += n % 2;
            n = n / 2;
        }
        return num + n;
    }
}
